<template>
	<view class="">
		<view class="">
			<button @click="goUser">跳我的</button>
			<button @click="goDetails">跳内置页（不带参）</button>
			<button @click="goDetailsPar">跳内置页（带参）</button>
		</view>
	</view>
</template>

<script>
	import {
		getIndex,
		getDetail
	} from "@/api/index.js"
	export default {
		data() {
			return {
				
			}
		},
		onLoad() {
			getIndex().then((res)=>{
				console.log(res)
			})
			
			let data = {
				id: 105
			}
			getDetail(data).then((res)=>{
				console.log(res)
			})
		},
		onReady() {
			console.log(this.$store)
			// vuex模块a
			console.log(this.$store.state.a.count)
			// vuex模块b
			console.log(this.$store.state.b.count)
			// vuex模块a mutations someMutation 方法
			this.$store.commit('someMutation')
			// vuex模块b mutations someMutation2方法
			this.$store.commit('someMutation2')
			// vuex模块a ations actionSomeMutation方法
			this.$store.dispatch('actionSomeMutation')
			// vuex模块b ations actionSomeMutation2方法
			this.$store.dispatch('actionSomeMutation2')
		},
		methods: {
			// ...mapMutations({
			//   add: 'increment' // 将 `this.add()` 映射为 `this.$store.commit('increment')`
			// })
			goUser(){
				this.$Router.pushTab('/userIndex')
			},
			goDetails(){
				this.$Router.push('/details')
			},
			goDetailsPar(){
				this.$Router.push({ path: '/details', query: { id:1 }})
				// 或者
				// this.$Router.push({ name: 'details', params: { id:1 }})
			}
		}
	}
</script>

<style>
</style>
